import AppLayout from '@/layouts/app.vue'
import { treeToArray } from "@/util/tree.js"
import modulesIndex from "./modulesIndex.js";

//设置进入页面是否需要登陆验证
const meta = { auth: true }

//设置首页
const indexPage = {
    path: '/index',
    name: 'index',
    meta:{
        auth: true,
        title:"首页"
    },
    component: () => import('@/view/index.vue')
}
modulesIndex.push(indexPage)

// 模版内页面展示
const sideBar = [{
    path: '/',
    component: AppLayout,
    meta,
    redirect: () => {
        return { path:"index" }
    },
    children: treeToArray(modulesIndex)
}]

// 单个页面显示：登陆页面等
const fameOutPage = [
    {
        path: '/login',
        name: 'login',
        meta:{
            auth: false,
            title:"登陆"
        },
        component: () => import('@/view/login.vue')
    }
]

// 重新组织后导出
export default [
    ...sideBar,
    ...fameOutPage
]
